using System;
using System.Globalization;
using jSLCore.Client.Presentation.jBinding;

namespace jSLApp.Client.Converters
{
    public class TimeSpanToTotalConverter : jChainConverter
    {
        public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var timeSpan = (TimeSpan)value;

            return timeSpan.TotalMilliseconds;
        }

        public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return TimeSpan.FromMilliseconds((double) value);
        }
    }
}